package rcfirewall;
import java.sql.*;
import javax.sql.*;

public class conexaoBD {

	String dbtime;
	String user = "root";
	String pass = "qwqwqw";
	String dbUrl = "jdbc:mysql://localhost/rcFirewall";
	String dbClass = "com.mysql.jdbc.Driver";
	

	
	public ResultSet montaDropDown2 (String query){
		
		ResultSet rs = null;
		
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Connection con = DriverManager.getConnection (dbUrl,user,pass);
			Statement stmt = con.createStatement();
			rs = stmt.executeQuery(query);
			
			
		
			} //end try

			catch(ClassNotFoundException e) {
			e.printStackTrace();
			}

			catch(SQLException e) {
			e.printStackTrace();
			}
		return rs;
		
	}
	
	public void insertBD (String insert){
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Connection con = DriverManager.getConnection (dbUrl,user,pass);
			Statement stmt = con.createStatement();
			stmt.execute(insert);
			
			
		    con.close();
			} //end try

			catch(ClassNotFoundException e) {
			e.printStackTrace();
			}

			catch(SQLException e) {
			e.printStackTrace();
			}
		
	}
	
}
			